Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CK Tile Gemm API and heuristics changes #1809

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

jakpiase
Copy link
Contributor

Proposed changes

Add api for CK TILE Gemm similar to FMHA's one and add instances

Checklist

Please put an x into the boxes that apply. You can also fill these out after creating the PR. If you're not sure, please don't hesitate to ask.

  • I have added tests relevant to the introduced functionality, and the unit tests are passing locally
  • I have added inline documentation which enables the maintainers with understanding the motivation
  • I have removed the stale documentation which is no longer relevant after this pull request
  • (If this change is user-facing) I have added release notes which provide the end users with a brief summary of the improvement from this pull request
  • I have run clang-format on all changed files
  • Any dependent changes have been merged

Discussion

Add api for CK Tile universal gemm and some instances for fp16 and bf16 cases. I'm not sure how the heuristic of choosing between comp and mem instances should be made so for now it is trivial and will be upgraded in the near future

@jakpiase jakpiase changed the title Jakpiase/ck tile gemm api CK Tile Gemm API and heuristics changes Jan 14, 2025
Copy link
Collaborator

@aosewski aosewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good start!

example/ck_tile/03_gemm/CMakeLists.txt Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/CMakeLists.txt Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/CMakeLists.txt Show resolved Hide resolved
example/ck_tile/03_gemm/gemm_basic.cpp Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/gemm_basic.hpp Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/instances/gemm_api.cpp Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/run_gemm_example.inc Show resolved Hide resolved
example/ck_tile/03_gemm/run_gemm_example.inc Show resolved Hide resolved
example/ck_tile/03_gemm/universal_gemm.cpp Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/run_gemm_example.inc Show resolved Hide resolved
example/ck_tile/03_gemm/gemm.hpp Show resolved Hide resolved
example/ck_tile/03_gemm/run_gemm_example.inc Outdated Show resolved Hide resolved
example/ck_tile/03_gemm/instances/gemm_api.cpp Outdated Show resolved Hide resolved
aosewski
aosewski previously approved these changes Jan 22, 2025
using BDataType = ck_tile::half_t;
using AccDataType = float;
using CDataType = ck_tile::half_t;
// ToDo: Add more bias config to support different categories of GEMM.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add your nick name to todo?

float gemm_(const ck_tile::GemmHostArgs& args, const ck_tile::stream_config& s);

/**
* \brief Invoke gemm function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use @ syntax instead of \. Please have a look at tile_partitioner file

@@ -0,0 +1,124 @@

// SPDX-License-Identifier: MIT
// Copyright (c) 2024-2025, Advanced Micro Devices, Inc. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 2025?

@@ -101,6 +100,30 @@ float gemm_calc(const ck_tile::GemmHostArgs& args, const ck_tile::stream_config&
return ave_time;
}

float gemm(const gemm_traits& t, const ck_tile::GemmHostArgs& args, const ck_tile::stream_config& s)
{
if(t.is_a_rowmajor && t.is_b_rowmajor && t.is_c_rowmajor)
Copy link
Contributor

@mozga-amd mozga-amd Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[[Consider]] Please have a look that we repeatedly use mechanisms to check whether we have a specific layout... t.is_a_rowmajor && t.is_b_rowmajor && t.is_c_rowmajor etc.
Maybe it would be worth considering has_enabled_RRR mechanis *(1), either at the traits structure level or as a separate mechanism? This way, we could avoid duplicating these checks, reduce the possibility of mistakes etc.

*(1) Example:

t.has_enabled_RRR()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants